<?php

namespace App\Models;


use Illuminate\Database\Eloquent\SoftDeletes;

class GiftLessonShare extends BaseModels
{
    use SoftDeletes;

    protected $table = 'gift_lesson_shares';
    protected $primaryKey = 'id';
    protected $dates = ['expired_at'];

    const SHARE_CODE_PREFIX = 'GL';

    const STATUS_CREATED = 0;
    const STATUS_ACCEPTED_EXPIRED = 1;
    const STATUS_ACCEPTED = 2;
    const STATUS_GIFT_EXPIRED = 3;
    const STATUS_GIFTED = 4;
    const STATUS_REFUND = 5;

    const EXPIRE_DAYS = 3;

    const LESSON_SHARES_MAX_LIMIT = 2000;

    public function student()
    {
        return $this->belongsTo(GiftLessonStudent::class, 'student_id', 'student_id');
    }

    public function acceptances()
    {
        return $this->hasMany(GiftLessonAcceptance::class, 'share_id');
    }

    public function getId()
    {
        return $this->id;
    }

    public function getStudentId()
    {
        return $this->student_id;
    }

    public function setStudentId($value)
    {
        $this->student_id = $value;
    }

    public function getShareCode()
    {
        return $this->share_code;
    }

    public function setShareCode($value)
    {
        $this->share_code = $value;
    }

    public function getLessonCount()
    {
        return $this->lesson_count;
    }

    public function setLessonCount($value)
    {
        $this->lesson_count = $value;
    }

    public function getExpiredAt()
    {
        return $this->expired_at;
    }

    public function setExpiredAt($value)
    {
        $this->expired_at = $value;
    }

    public function getStatus()
    {
        return $this->status;
    }

    public function setStatus($value)
    {
        $this->status = $value;
    }
}